<?php

    namespace App\Models\V1_bak;

    use Illuminate\Database\Eloquent\Model;
    use Illuminate\Support\Facades\DB;

    class Goods extends Model
    {
        /**
         * 获取商品列表
         * @param        $orderBy
         * @param        $sortType
         * @param int    $startPage
         * @param int    $pageNum
         * @param string $where
         *
         * @return array
         * author: walker
         * Date: 2019/10/23
         * Time: 11:50
         */
        public function getGoodsLists($orderBy, $sortType, $startPage = 1, $pageNum = 10, $where = '')
        {
            //        $field = "ProId,";
            return DB::table('products')
                     ->offset($startPage)
                     ->limit($pageNum)
                     ->where($where)
                     ->orderBy($orderBy, $sortType)
                     ->get()
                     ->toArray();
        }
    }
